**Replication do file for the Brannon, Thomas and DiBlasi. "Fighting for Peace? The Effects of Women's Participation in Rebel Groups on Peace Negotiations." Journal of Politics
use "Brannon_Thomas_Diblasi_JOP_ms.dta", clear

**Label variables
label variable female_members_yearly "Female Members"
label variable  v2x_delibdem "Democracy"
label variable medcount "# Mediation Attempts" 
label variable lngovdeaths "Government Battle Deaths"
label variable lnrebdeaths "Rebel Battle Deaths"
label variable rebelchange "Rebel Leadership Change"
label variable pts_average "Political Terror Scale Average"
label variable ideolleft "Leftist Rebel Ideology"
label variable ideolrel "Religious Rebel Ideology"
label variable N_rebelGroups "Number of Rebel Groups"
label variable Terr "Territorial Control"
label variable rebstrengthvar "Relative Rebel Strength"
label variable govtchange "Government Leadership Change"
label variable lnOSV "Rebel One-Sided Violence"
label variable attack "Number of Rebel Terror Attacks"
label variable rebel_support_explicit "Rebel External Support"
label variable negotiation_demand_binary "Negotiation Demand"
label variable negotiations_ALL "Negotiation Incidence"
label variable ethnic "Ethnic Conflict"
label variable frontline_prev_best "Female Combatant Prevalence:WAAR"


**Manuscript Replication Models

*Table 1: Logistic Regression Examining the Effect of Female Membership on Negotiation Incidence and Negotiation Demands

*Model 1
logit negotiations_ALL female_members_yearly, cluster (dyad_id)
estimates store T1m1

*Model 2
logit negotiations_ALL female_members_yearly v2x_delibdem pts_average medcount   lngovdeaths lnrebdeaths rebstrengthvar rebelchange govtchange ideolleft ideolrel ethnic N_rebelGroups Terr rebel_support_explicit attack lnOSV  , cluster (dyad_id)
estimates store T1m2
margins,  dydx(female_members_yearly) at((asobserved) ) level(95) 

*Figure 1: Expected Change in Probability of Negotiation Incidence by Female Members
marginsplot,  ytitle(Expected Change in Probability of Negotiations)

*Model 3
logit negotiation_demand_binary female_members_yearly, cluster (dyad_id)
estimates store T2m1

*Model 4
logit negotiation_demand_binary female_members_yearly v2x_delibdem pts_average medcount   lngovdeaths lnrebdeaths rebstrengthvar rebelchange govtchange ideolleft ideolrel ethnic N_rebelGroups Terr rebel_support_explicit attack lnOSV  , cluster (dyad_id)
estimates store T2m2
margins,  dydx(female_members_yearly) at((asobserved) ) level(95) 

*Figure 2: Expected Change in Probability of Negotiation Demand by Female Members
marginsplot,  ytitle(Expected Change in Probability of Negotiation Demands)

esttab  T1m1 T1m2 T2m1 T2m2  using "table1_combine.rtf", replace label se star(* 0.10 ** 0.05 *** 0.01) 

*Figure 3: Causal Mediation Models Examining the Effect of Women, as Mediated by Rebel Behavior, on the Probability of Negotiations

***Figure A: Rebel Terror Attacks
medeff (regress attack female_members_yearly v2x_delibdem pts_average medcount  lngovdeaths lnrebdeaths rebstrengthvar rebelchange govtchange ideolleft ideolrel ethnic N_rebelGroups Terr rebel_support_explicit  lnOSV) (logit negotiations_ALL female_members_yearly v2x_delibdem pts_average medcount   lngovdeaths lnrebdeaths rebstrengthvar rebelchange govtchange ideolleft ideolrel ethnic N_rebelGroups Terr rebel_support_explicit attack lnOSV), mediate(attack) treat(female_members_yearly) vce (cluster dyadid) sims(1000)
estimates store CM1

*Figure B: Rebel External Support
medeff (logit rebel_support_explicit female_members_yearly v2x_delibdem pts_average medcount  lngovdeaths lnrebdeaths rebstrengthvar rebelchange govtchange ideolleft ideolrel ethnic N_rebelGroups Terr attack  lnOSV) (logit negotiations_ALL female_members_yearly v2x_delibdem pts_average medcount   lngovdeaths lnrebdeaths rebstrengthvar rebelchange govtchange ideolleft ideolrel ethnic N_rebelGroups Terr rebel_support_explicit attack lnOSV), mediate(rebel_support_explicit) treat(female_members_yearly) vce (cluster dyad_id) sims(1000)
estimates store CM3

***coefficients from causal mediation models inputted into casual_mediation_terrorism.dta and causal_mediation_external_support.dta, respectively. Use following datasets to generate Figure 3. 

clear
use causal_mediation_terrorism.dta 
label define id 1 " Total" 2 "ADE" 3 "ACME" 
label values id id
twoway (rcap min max id, hor ) (scatter id beta, mlabel(id) mlabposition(1))



